package com.np.demo1.delegate1;

public class Index {
    public void test1(){
        MathService math = new MathService();

        math.setCalculator(new AddCalculator());
        int result1 = math.calc(1,2);
        System.out.println(result1);

        math.setCalculator(new MultiCalculator());
        int result2 = math.calc(1,2);
        System.out.println(result2);
    }
}
